gtk/gtkseparator: Do not use GET_PRIVATE macro all the time
authorJavier Jardón <jjardon@gnome.org>
Thu, 26 Aug 2010 16:00:09 +0000 (18:00 +0200)
committerJavier Jardón <jjardon@gnome.org>
Thu, 26 Aug 2010 16:00:09 +0000 (18:00 +0200)
Use a private pointer instead

gtk/gtkseparator.c
gtk/gtkseparator.h

index 45e93f3fb8e508f93863fb1d230a999a4dce32da..db293c90593b2f0d8a98dd1916289f5f1cdeee0c 100644 (file)
  */
 
 
-enum {
-  PROP_0,
-  PROP_ORIENTATION
-};
-
-
-typedef struct _GtkSeparatorPrivate GtkSeparatorPrivate;
-
-struct _GtkSeparatorPrivate
+struct _GtkSeparatorPriv
 {
   GtkOrientation orientation;
 };
 
-#define GTK_SEPARATOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_SEPARATOR, GtkSeparatorPrivate))
 
+enum {
+  PROP_0,
+  PROP_ORIENTATION
+};
 
 static void       gtk_separator_set_property (GObject        *object,
                                               guint           prop_id,
@@ -94,14 +89,19 @@ gtk_separator_class_init (GtkSeparatorClass *class)
                                     PROP_ORIENTATION,
                                     "orientation");
 
-  g_type_class_add_private (object_class, sizeof (GtkSeparatorPrivate));
+  g_type_class_add_private (object_class, sizeof (GtkSeparatorPriv));
 }
 
 static void
 gtk_separator_init (GtkSeparator *separator)
 {
   GtkWidget *widget = GTK_WIDGET (separator);
-  GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (separator);
+  GtkSeparatorPriv *private;
+
+  separator->priv = G_TYPE_INSTANCE_GET_PRIVATE (separator,
+                                                 GTK_TYPE_SEPARATOR,
+                                                 GtkSeparatorPriv);
+  private = separator->priv;
 
   gtk_widget_set_has_window (GTK_WIDGET (separator), FALSE);
 
@@ -117,7 +117,8 @@ gtk_separator_set_property (GObject      *object,
                             const GValue *value,
                             GParamSpec   *pspec)
 {
-  GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (object);
+  GtkSeparator *separator = GTK_SEPARATOR (object);
+  GtkSeparatorPriv *private = separator->priv;
 
   switch (prop_id)
     {
@@ -137,7 +138,8 @@ gtk_separator_get_property (GObject    *object,
                             GValue     *value,
                             GParamSpec *pspec)
 {
-  GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (object);
+  GtkSeparator *separator = GTK_SEPARATOR (object);
+  GtkSeparatorPriv *private = separator->priv;
 
   switch (prop_id)
     {
@@ -154,7 +156,8 @@ static void
 gtk_separator_size_request (GtkWidget      *widget,
                             GtkRequisition *requisition)
 {
-  GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (widget);
+  GtkSeparator *separator = GTK_SEPARATOR (widget);
+  GtkSeparatorPriv *private = separator->priv;
   gboolean wide_separators;
   gint     separator_width;
   gint     separator_height;
@@ -188,7 +191,8 @@ static gboolean
 gtk_separator_expose (GtkWidget      *widget,
                       GdkEventExpose *event)
 {
-  GtkSeparatorPrivate *private = GTK_SEPARATOR_GET_PRIVATE (widget);
+  GtkSeparator *separator = GTK_SEPARATOR (widget);
+  GtkSeparatorPriv *private = separator->priv;
   gboolean wide_separators;
   gint     separator_width;
   gint     separator_height;
index 6b3e519395ed1fb14418b073dd144e0a9d6192a0..b1a416756e5832919734caf44222b1792e595e67 100644 (file)
@@ -46,11 +46,14 @@ G_BEGIN_DECLS
 
 
 typedef struct _GtkSeparator       GtkSeparator;
+typedef struct _GtkSeparatorPriv   GtkSeparatorPriv;
 typedef struct _GtkSeparatorClass  GtkSeparatorClass;
 
 struct _GtkSeparator
 {
   GtkWidget widget;
+
+  GtkSeparatorPriv *priv;
 };
 
 struct _GtkSeparatorClass